//
//  TicketCell.m
//  ImGuider
//
//  Created by 王鹏宇 on 2017/12/28.
//  Copyright © 2017年 imguider. All rights reserved.
//

#import "TicketCell.h"
@interface TicketCell ()

@property (weak, nonatomic) IBOutlet UIImageView *ticketImageView;
@property (weak, nonatomic) IBOutlet UILabel *ticketNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UIView *mengbanView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageViewH;

@end


@implementation TicketCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.selectionStyle =  UITableViewCellSelectionStyleNone;
    
    self.mengbanView.backgroundColor = kMengBanColor;
    self.imageViewH.constant = (kScreenWidth - 32) * 9.0 / 16;
}

- (void)setTicket:(TicketModel *)ticket {
    
    _ticket = ticket;
    
    [self.ticketImageView setImageURL:[NSURL URLWithString:ticket.pictureArray.firstObject] placeholderImage:kPlaceholderRec];
    self.ticketNameLabel.text = ticket.title;
    
    if ([[AppManager sharedManager].currencyCode isEqualToString:@"CNY"]) {
        self.priceLabel.text = [NSString stringWithFormat:@"¥%@",@(ticket.price.integerValue / 100.0f)];
    }else{
        self.priceLabel.text = [NSString stringWithFormat:@"$%@",@(ticket.price.integerValue / 100.0f)] ;
    }
    
}

@end
